package com.ruoyi.app.mapper;

import java.util.List;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.app.domain.DebtRecords;
import com.ruoyi.app.domain.vo.DebtRecordsVo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.security.core.parameters.P;

/**
 * 供应商信息Mapper接口
 * 
 * @author ruoyi
 * @date 2024-12-29
 */
public interface DebtRecordsMapper extends BaseMapper<DebtRecords> {


    /**
     * 本月借钱款统计
     * @param shopId
     * @return
     */
//    @Select("select COUNT(1) TOTAL_NUMBER, SUM(AMOUNT) TOTAL_AMOUNT, TYPE, TYPE_TXT  from debt_records WHERE DEL_FLAG = 0 " +
//            " AND SHOP_ID = #{shopId}  AND DATE_FORMAT(CREATE_TIME, '%Y-%m') = DATE_FORMAT(CURRENT_DATE(), '%Y-%m') GROUP BY SHOP_ID,TYPE")
    @Select("select COUNT(1) TOTAL_NUMBER, SUM(AMOUNT) TOTAL_AMOUNT, TYPE, TYPE_TXT  from debt_records WHERE DEL_FLAG = 0 " +
            " AND SHOP_ID = #{shopId} AND STATUS = #{status} GROUP BY SHOP_ID,TYPE")
    List<DebtRecordsVo> currentMonthStatistics(@Param("shopId") String shopId, @P("status") String status);
}
